<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../pages/asset.css">
    <style>#div1{width:80px;position:absolute;background-color: #ccc;border:1px solid black; display:none;}</style>
    <script>
        document.oncontextmenu=function(ev){//oncontextmenu表示右键下拉菜单
            var oEvent=ev||event;
            var oDiv=document.getElementById('div1');
            oDiv.style.display='block';
            oDiv.style.left=oEvent.clientX+'px';//点击右键，让菜单跟着鼠标显示
            oDiv.style.top=oEvent.clientY+'px';
            return false;
        };
        document.onclick=function(){//点击页面其他位置，右键下拉菜单消失
            var oDiv=document.getElementById('div1');
            oDiv.style.display='none';
        };
    </script>
</head>
<body>
<div id="div1">
    <ul>
        <li>aaa</li>
        <li>bbb</li>
        <li>ccc</li>
        <li>ddd</li>
    </ul>
</div>
</body>
</html>